<!DOCTYPE html>
<html lang="en" xmlns:http="http://www.w3.org/1999/xhtml" xmlns: xmlns:>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"
    />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>福山</title>
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../css/element/elemet-ui.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper/swiper-4.1.6.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/rem.css" />
    <link rel="stylesheet" href="../js/map/DrawingManager_min.css">
    <link href="../assets/css/GA.css" type="text/css" rel="stylesheet">
    <style>
        #app {
            width: 100vw;
            height: 100vh;
            display: flex;
            flex-direction: column;
            flex-wrap: nowrap;
        }

        .pubHead {
            width: 100%;
            height: 80px;
            padding-left: 40px;
            box-sizing: border-box;
            background-color: #011a42;
        }

        .log {
            float: left;
            width: 40px;
            height: 42px;
            margin-top: 19px;
            background: url('../assets/image/logo.png') no-repeat;
        }

        .logtitle {
            float: left;
            margin-left: 10px;
            height: 80px;
            line-height: 80px;
            width: auto;
            font-size: 22px;
            color: #79afff;
        }

        .tabUl {
            float: left;
            margin-left: 285px;
            overflow: hidden;
        }

        .tabUl li {
            float: left;
            padding: 0px 20px;
            height: 80px;
            line-height: 80px;
            color: #79afff;
            font-size: 18px;
            cursor: pointer;
        }

        .tabUl li.li_active {
            height: 77px;
            font-size: 18px;
            line-height: 80px;
            border-bottom: 3px solid #0070ff;
        }

        .warnActive {
            width: 2rem !important;
            height: 2rem !important;
            margin-top: 0rem !important;
        }

        .el-select,
        .jiadun-container {
            display: flex;
            flex-direction: column;
            flex-wrap: nowrap;
        }

        .main {
            flex: 1;
            background: #002759;
            width: 100%;
            padding: 0px 28px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            flex-wrap: nowrap;
        }

        .top {
            width: 100%;
            height: 70px;
        }

        .top>span {
            height: 70px;
            line-height: 70px;
            display: inline-block;
            /* float: left; */
            margin-left: 10px;
            font-size: 18px;
            color: #79afff;
        }

        .top .circle {
            width: 8px;
            height: 8px;
            background-color: #0070ff;
            margin-top: 30px;
            margin-left: 15px;
        }

        .top .endspan {
            color: #0068ed;
        }

        .main_body {
            width: 100%;
            flex: 1;
            display: flex;
            margin-bottom: 20px;
            border-radius: 6px;
        }

        .op_list {
            width: 20rem;
            display: flex;
            flex-direction: column;
            border-radius: 0.5rem;
            background: #fff;
            margin-right: 1.5rem;
        }

        .op_list_title {
            width: 100%;
            height: 6vh;
            border-bottom: 1px solid #ccc;
            font-size: 1rem;
            font-weight: 700;
            line-height: 8vh;
            text-indent: 1rem;
            position: relative;
        }

        .op_list_content {
            display: flex;
            flex: 1;
            padding: 0 1rem;
            flex-direction: column;
        }

        .search_box {
            display: flex;
        }

        .op_box {
            flex: 1;
            border-radius: 0.5rem;
            background: #fff;
        }

        .op_box_title {
            width: 100%;
            height: 6vh;
            border-bottom: 1px solid #ccc;
            font-size: 1rem;
            font-weight: 700;
            line-height: 8vh;
            text-indent: 1rem;
            position: relative;
        }

        .op_box_content {
            padding-top: 1rem;
            display: flex;
            max-height: 65vh;
            justify-content: center;
        }

        .container {
            width: 22rem;
            height: auto;
            border: 1px solid #ccc;
            margin-right: 1rem;
            padding: 0.5rem;
            overflow: auto;
            box-sizing: border-box;
            border-radius: 0.3rem;
        }

        .monitorList .el-table__header-wrapper {
            height: 0!important
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div id="pubHead" class="pubHead">
            <div class="log"></div>
            <div class="logtitle">福山公安数据治理系统</div>
            <ul class="tabUl">
                <li :class="{'li_active':activeIndex === index}" v-for="(item, index) in menuList" :key="index" @click="routerGo(item)">{{item.name}}
                </li>
                <!-- <li :class="{'li_active':activeIndex === 1}">数据源注册</li>
            <li>数据采集任务管理</li>
            <li>数据采集监控</li>
            <li>录入工具</li>
            <li>资源目录</li> -->
            </ul>
        </div>
        <div class="main">
            <div class="top">
                <span class="circle"></span>
                <span>智能作战系统</span>
                <span>></span>
                <span>联防联控</span>
                <span>></span>
                <span class="endspan">重点人员管控</span>
                <el-button type="primary" size="mini" @click="goBack" style="position:absolute;right:5rem;margin-top:1rem">
                    返回
                </el-button>
            </div>
            <div class="main_body">
                <div class="op_list">
                    <div class="op_list_title">
                        任务列表
                        <el-button type="primary" size="mini" @click="addOp" style="position:absolute;right:1rem;top:50%;transform: translateY(-50%)">新建任务
                        </el-button>
                    </div>
                    <div class="op_list_content">
                        <el-select v-model="opSelectType" placeholder="请选择" style="margin-top:.5rem">
                            <el-option v-for="item in opTypeList" :key="item.value" :label="item.value" :value="item.key">
                            </el-option>
                        </el-select>
                        <div class="search_box" style="margin-top:.5rem">
                            <el-input v-model="opSearchWord" placeholder="请输入内容" style="margin-right: .5rem"></el-input>
                            <el-button type="primary" size="mini" @click="searchOp()" icon="el-icon-search">搜索</el-button>
                        </div>
                        <el-table :data="taskList" style="width: 100%;margin-bottom: 0.5rem" height="match-parent">
                            <el-table-column prop="tTaskTypeName" label="任务类型">
                            </el-table-column>
                            <el-table-column prop="tName" label="任务名称">
                            </el-table-column>
                            <el-table-column label="操作" width="100">
                                <template slot-scope="scope">
                                    <i v-if="scope.row.tState===0" class="el-icon-caret-right" @click="startTask(scope.row)" style="cursor:pointer;margin-left:.3rem"></i>
                                    <i v-if="scope.row.tState===1" class="el-icon-remove" @click="pauseTask(scope.row)" style="cursor:pointer;margin-left:.3rem"></i>
                                    <i class="el-icon-view" @click="showTask(scope.row)" style="cursor:pointer;margin-left:.3rem"></i>
                                    <i class="el-icon-delete" @click="handleDelete(scope.row)" style="cursor:pointer;margin-left:.3rem"></i>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
                <div class="op_box">
                    <div class="op_box_title">
                        <span v-if="opControle === 0">新建任务</span>
                        <span v-if="opControle === 1">修改任务</span>
                    </div>
                    <div class="op_box_content" v-if="opControle === 0">
                        <div class="container">
                            <el-form label-width="4rem" :model="addForm">
                                <el-form-item label="任务类型">
                                    <el-input v-model="addForm.t_task_type_name"></el-input>
                                </el-form-item>
                                <el-form-item label="任务名称">
                                    <el-input v-model="addForm.t_name"></el-input>
                                </el-form-item>
                                <el-form-item label="监控列表">
                                    <el-button size="mini" @click="t_feature_way = 0" :type="t_feature_way === 0 ? 'primary' : '' ">添加特定特征码
                                    </el-button>
                                    <br/>
                                    <el-button size="mini" @click="t_feature_way = 1" :type="t_feature_way === 1 ? 'primary' : '' ">添加区域特征码
                                    </el-button>
                                    <br/>
                                    <el-button size="mini" @click="t_feature_way = 2" :type="t_feature_way === 2 ? 'primary' : '' ">批量导入特征码
                                    </el-button>
                                </el-form-item>
                            </el-form>
                            <div class="monitorList">
                                <div v-if="t_feature_way===0" style="box-sizing:border-box;padding: .5rem">
                                    <el-button size="mini" type="primary" @click="addMoniter" style="margin-left:10px" class="">+</el-button>
                                    <el-table :data="monitorList" style="width: 100%">
                                        <el-table-column>
                                            <template slot-scope="scope" :width="160">
                                                <el-select v-model="scope.row.key" placeholder="请选择">
                                                    <el-option v-for="item in taskFeatureList" :key="item.key" :label="item.value" :value="item.key">
                                                    </el-option>
                                                </el-select>
                                            </template>
                                        </el-table-column>
                                        <el-table-column :width="200">
                                            <template slot-scope="scope">
                                                <el-input v-model="scope.row.value" placeholder="请输入内容"></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column :width="80">
                                            <template slot-scope="scope">
                                                <div>
                                                    <!-- <i class="el-icon-edit-outline" @click="updateOp(scope.row)" style="font-size:1rem;cursor:pointer"></i> -->
                                                    <i class="el-icon-delete" @click="deleteRow(scope.$index, scope.row)" style="font-size:1rem;cursor:pointer"></i>
                                                </div>
                                            </template>
                                        </el-table-column>
                                    </el-table>
                                </div>
                                <div v-if="t_feature_way===1" style="box-sizing:border-box;padding: .5rem">
                                    <el-cascader size="large" :options="areaOptions" v-model="monitorSelect" @change="chandleAreaChange">
                                    </el-cascader>
                                </div>
                                <div v-if="t_feature_way===2" style="box-sizing:border-box;margin:0 1rem 0;border:1px solid #ccc;min-height:10vh;display:flex;flex-direction:column;align-items:start;padding:1rem 1rem">
                                    <el-button size="mini" icon="el-icon-download" @click="downloadFile" style="height:1.5rem;width:5.5rem;">模版下载
                                    </el-button>
                                    <br/>
                                    <el-upload class="upload-demo" ref="upload" :action="fileUrl+'fs/task/importTemplate'" :on-remove="handleRemoveFile" :on-success="handleUploadFile"
                                        multiple :limit="1">
                                        <el-button size="mini" icon="el-icon-upload2" style="height:1.5rem">导入特征码
                                        </el-button>
                                    </el-upload>

                                </div>
                            </div>
                        </div>
                        <div class="container">
                            <el-form label-width="4rem" :model="addForm">
                                <el-form-item label="任务等级">
                                    <div :class="addForm.t_grade === 1 ? 'warnActive' : ''" style="background:red;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"
                                        @click="addFormgrd(1)"></div>
                                    <div :class="addForm.t_grade === 2 ? 'warnActive' : ''" style="background:orange;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"
                                        @click="addFormgrd(2)"></div>
                                    <div :class="addForm.t_grade === 3 ? 'warnActive' : ''" style="background:yellow;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"
                                        @click="addFormgrd(3)"></div>
                                    <div :class="addForm.t_grade === 4 ? 'warnActive' : ''" style="background:green;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"
                                        @click="addFormgrd(4)"></div>
                                </el-form-item>
                                <el-form-item label="告警方式">
                                    <el-button size="mini" @click="addForm.t_warning_way = 1" :type="addForm.t_warning_way === 1 ? 'primary' : '' " v-if="false">短信
                                    </el-button>
                                    <el-button size="mini" @click="addForm.t_warning_way = 2" :type="addForm.t_warning_way === 2 ? 'primary' : '' " v-if="false">APP推送
                                    </el-button>
                                    <el-button size="mini" @click="addForm.t_warning_way = 3" :type="addForm.t_warning_way === 3 ? 'primary' : '' ">系统提示
                                    </el-button>
                                </el-form-item>
                                <el-form-item label="告警设置">
                                    <el-input v-model="addForm.t_warning_number" placeholder="请输入告警次数" style="width:7rem;float:left;margin-right:1rem"></el-input>
                                    <el-select v-model="addForm.t_warning_fm" placeholder="请选择告警频率" style="width: 8rem">
                                        <el-option v-for="item in warning_fm" :key="item.value" :label="item.key" :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-form>
                        </div>
                        <div class="container">
                            <el-form label-width="4rem" :model="addForm">
                                <el-form-item label="布控区域">
                                    <el-select v-model="addForm.t_control_area" placeholder="请选择布控区域" style="width: 8rem" @change="getEquipments">
                                        <el-option label="全城布控" :value="1">
                                        </el-option>
                                        <el-option label="区域布控" :value="2">
                                        </el-option>
                                        <el-option label="外围布控" :value="3" v-if="false">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <div style="width:20rem;height:10rem">
                                    <small-map />
                                </div>
                                <el-button size="mini" type="primary" @click="mapContentVisble = true" v-if="addForm.t_control_area===2" style="height:1.5rem">地图选点
                                </el-button>
                                <el-form-item label="监控类型">
                                    <el-checkbox-group v-model="t_control_type">
                                        <el-checkbox :label="2">离开监控区</el-checkbox>
                                        <el-checkbox :label="1">进入监控区</el-checkbox>
                                    </el-checkbox-group>
                                </el-form-item>
                            </el-form>
                        </div>
                    </div>
                    <div class="op_box_content" v-if="opControle === 1">
                        <div class="container">
                            <el-form label-width="4rem" :model="updateForm">
                                <el-form-item label="任务类型">
                                    <el-input v-model="updateForm.t_task_type_name" disabled></el-input>
                                </el-form-item>
                                <el-form-item label="任务名称">
                                    <el-input v-model="updateForm.t_name" disabled></el-input>
                                </el-form-item>
                                <el-form-item label="监控列表">
                                    <el-button size="mini" :type="up_t_feature_way === 0 ? 'primary' : '' ">添加特定特征码
                                    </el-button>
                                    <br/>
                                    <el-button size="mini" :type="up_t_feature_way === 1 ? 'primary' : '' ">添加区域特征码
                                    </el-button>
                                    <br/>
                                    <el-button size="mini" :type="up_t_feature_way === 2 ? 'primary' : '' ">批量导入特征码
                                    </el-button>
                                </el-form-item>
                            </el-form>
                            <div class="monitorList">
                                <div v-if="up_t_feature_way===0" style="box-sizing:border-box;padding: .5rem">
                                    <!-- <el-button size="mini" type="primary">+</el-button> -->
                                    <el-table :data="upMonitorList" style="width: 100%">
                                        <el-table-column>
                                            <template slot-scope="scope" :width="160">
                                                <el-select v-model="scope.row.key" disabled placeholder="请选择">
                                                    <el-option v-for="item in taskFeatureList" :key="item.key" :label="item.value" :value="item.key">
                                                    </el-option>
                                                </el-select>
                                            </template>
                                        </el-table-column>
                                        <el-table-column :width="200">
                                            <template slot-scope="scope">
                                                <el-input v-model="scope.row.value" disabled placeholder="请输入内容"></el-input>
                                            </template>
                                        </el-table-column>
                                        <el-table-column :width="80">
                                            <template slot-scope="scope">
                                                <div>
                                                    <!-- <i class="el-icon-edit-outline" @click="updateOp(scope.row)" style="font-size:1rem;cursor:pointer"></i> -->
                                                    <i class="el-icon-delete" v-if="false" @click="deleteRow(scope.$index, scope.row)" style="font-size:1rem;cursor:pointer"></i>
                                                </div>
                                            </template>
                                        </el-table-column>
                                    </el-table>
                                </div>
                                <div v-if="up_t_feature_way===1" style="box-sizing:border-box;padding: .5rem">
                                    <!-- <el-select v-model="upMonitorSelect" placeholder="请选择" style="width: 6rem">
                                  <el-option v-for="item in areaTypeList" :key="item.value" :label="item.name" :value="item.value">
                                  </el-option>
                                </el-select> -->
                                    <el-cascader size="large" :options="areaOptions" v-model="upMonitorSelect" @change="chandleAreaChange" disabled>
                                    </el-cascader>
                                    <!-- <div>{{upAreaCode | areaFilter}}</div> -->
                                </div>
                                <div v-if="up_t_feature_way===2" style="box-sizing:border-box;margin:0 1rem 0;border:1px solid #ccc;min-height:10vh;display:flex;flex-direction:column;align-items:start;padding:1rem 1rem">
                                    <el-button size="mini" icon="el-icon-download" @click="" style="height:1.5rem;width:5.5rem;">模版下载
                                    </el-button>
                                    <br/>
                                    <el-upload class="upload-demo" :action="fileUrl+'fs/task/importTemplate'" :on-remove="handleRemoveFile" :on-success="handleUploadFile"
                                        multiple :limit="1">
                                        <el-button size="mini" icon="el-icon-upload2" @click="" style="height:1.5rem">导入特征码
                                        </el-button>
                                    </el-upload>
                                </div>
                            </div>
                        </div>
                        <div class="container">
                            <el-form label-width="4rem" :model="updateForm">
                                <el-form-item label="任务等级">
                                    <div :class="updateForm.t_grade === 1 ? 'warnActive' : ''" style="background:red;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"></div>
                                    <div :class="updateForm.t_grade === 2 ? 'warnActive' : ''" style="background:orange;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"></div>
                                    <div :class="updateForm.t_grade === 3 ? 'warnActive' : ''" style="background:yellow;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"></div>
                                    <div :class="updateForm.t_grade === 4 ? 'warnActive' : ''" style="background:green;width:1.5rem;height:1.5rem;border-radius:1.5rem;margin-top:.2rem;margin-left:1rem;float:left"></div>
                                </el-form-item>
                                <el-form-item label="告警方式">
                                    <el-button size="mini" :type="updateForm.t_warning_way === 1 ? 'primary' : '' " v-if="false">短信
                                    </el-button>
                                    <el-button size="mini" :type="updateForm.t_warning_way === 2 ? 'primary' : '' " v-if="false">APP推送
                                    </el-button>
                                    <el-button size="mini" :type="updateForm.t_warning_way === 3 ? 'primary' : '' ">系统提示
                                    </el-button>
                                </el-form-item>
                                <el-form-item label="告警设置">
                                    <el-input v-model="updateForm.t_warning_number" disabled placeholder="请输入告警次数" style="width:7rem;float:left;margin-right:1rem"></el-input>
                                    <el-select v-model="updateForm.t_warning_fm" disabled placeholder="请选择告警频率" style="width: 8rem">
                                        <el-option v-for="item in warning_fm" :key="item.value" :label="item.key" :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-form>
                        </div>
                        <div class="container">
                            <el-form label-width="4rem" :model="updateForm">
                                <el-form-item label="布控区域">
                                    <el-select v-model="updateForm.t_control_area" disabled placeholder="请选择布控区域" style="width: 8rem">
                                        <el-option label="全城布控" :value="1">
                                        </el-option>
                                        <el-option label="区域布控" :value="2">
                                        </el-option>
                                        <el-option label="外围布控" :value="3" v-if="false">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <div style="width:20rem;height:10rem">
                                    <small-map></small-map>
                                </div>
                                <el-button size="mini" type="primary" @click="mapContentVisble=true" v-if="updateForm.t_control_area===2" style="height:1.5rem">地图选点
                                </el-button>
                                <el-form-item label="监控类型">
                                    <el-checkbox-group v-model="up_t_control_type" disabled>
                                        <el-checkbox :label="2">离开监控区</el-checkbox>
                                        <el-checkbox :label="1">进入监控区</el-checkbox>
                                    </el-checkbox-group>
                                </el-form-item>
                            </el-form>
                        </div>
                    </div>
                    <el-button v-if="opControle === 0" type="primary" style="position:absolute;margin-top:1rem ;left:50%;transform:translateX(150%);padding-left:2rem;padding-right:2rem"
                        @click="saveAdd()">保存
                    </el-button>
                    <!--<el-button v-if="opControle === 1" type="primary" style="position:absolute;margin-top:1rem ;left:50%;transform:translateX(150%);padding-left:2rem;padding-right:2rem"-->
                    <!--@click="saveUpdate()">保存-->
                    <!--</el-button>-->
                </div>
            </div>
        </div>
        <el-dialog title="选择设备范围" :visible.sync="mapContentVisble" width="80%" center>
            <div style="width:100%;height:30rem">
                <my-map ref='bigmap' :draw="drawTool" :areapoint.sync="areaPoint" :equipmentpoints="equipmentPoints"></my-map>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="info" @click="$refs.bigmap.clearAll()" v-if="opControle === 0">清 空</el-button>
                <el-button type="primary" @click="mapContentVisble = false">确 定</el-button>
            </span>
        </el-dialog>
    </div>
    <!-- 引入组件库 -->
    <script type="text/javascript" src="../js/vue/vue.js"></script>
    <!--<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>-->
    <script src="../js/jquery-3.0.0.min.js.js"></script>
    <script type="text/javascript" src="../js/element/element.js"></script>
    <script type="text/javascript" src="../js/swiper/swiper-4.1.6.min.js"></script>
    <script type="text/javascript" src="../js/urls.js"></script>
    <script src="../js/areaData.js"></script>
    <script src="../js/map/baiduInterface.js"></script>
    <!-- <script src="../js/map/mapFunction.js"></script> -->
    <script src="../js/axios.js"></script>
    <script type="text/javascript" src="../js/utils.js"></script>
    <script src="../js/map/DrawingManager_min.js"></script>
    <script src="../js/geoUtils.js"></script>
    <script src="../js/mapComponentPeople.js"></script>
    <script src="../js/smallmap.js"></script>

    <script type="text/javascript">
        $(function () {
            var vm;
            vm = new Vue({
                el: '#app',
                data: {
                    mapContentVisble: false,
                    mapOption: '1',
                    drawTool: '1',
                    equipmentPoints: [
                        // {
                        //     lng: '121.75',
                        //     lat: '30.75',
                        //     id: '12'
                        // }
                    ],
                    menuList: [{
                        name: '数据源注册',
                        path: '/'
                    },
                    {
                        name: '数据采集任务管理',
                        path: '/'
                    },
                    {
                        name: '数据采集监控',
                        path: '/'
                    },
                    {
                        name: '录入工具',
                        path: '/'
                    },
                    {
                        name: '资源目录',
                        path: '/'
                    }
                    ],
                    activeIndex: 0,
                    showTable1: 1,
                    list: [],
                    opTypeList: [],
                    opSearchWord: '',
                    opList: [],
                    opSelectType: '',
                    opControle: null,
                    fileUrl: fileUrl,
                    addForm: {
                        t_task_type_name: null,
                        t_name: null,
                        t_grade: null,
                        t_feature_way: null,
                        t_warning_way: null,
                        t_warning_number: null,
                        t_warning_fm: null,
                        t_control_area: null,
                        t_control_type: null
                    },
                    addFormT: {
                        t_task_type_name: null,
                        t_name: null,
                        t_grade: null,
                        t_feature_way: null,
                        t_warning_way: null,
                        t_warning_number: null,
                        t_warning_fm: null,
                        t_control_area: null,
                        t_control_type: null
                    },
                    updateForm: {
                        t_task_type_name: null,
                        t_name: null,
                        t_grade: null,
                        t_feature_way: null,
                        t_warning_way: null,
                        t_warning_number: null,
                        t_warning_fm: null,
                        t_control_area: null,
                        t_control_type: null
                    },
                    t_control_type: [],
                    up_t_control_type: [],
                    importId: '',
                    t_feature_way: null,
                    warning_fm: [{
                        key: '5秒',
                        value: 5000
                    },
                    {
                        key: '10秒',
                        value: 10000
                    },
                    {
                        key: '15秒',
                        value: 15000
                    },
                    {
                        key: '20秒',
                        value: 20000
                    },
                    {
                        key: '30秒',
                        value: 30000
                    },
                    {
                        key: '1分钟',
                        value: 60000
                    },
                    {
                        key: '2分钟',
                        value: 120000
                    },
                    {
                        key: '3分钟',
                        value: 180000
                    },
                    {
                        key: '5分钟',
                        value: 300000
                    },
                    {
                        key: '10分钟',
                        value: 600000
                    },
                    {
                        key: '30分钟',
                        value: 1800000
                    },
                    {
                        key: '1小时',
                        value: 3600000
                    }
                    ],
                    areaOptions: provinceAndCityData, //TODO
                    monitorList: [],
                    monitorSelect: [],
                    upMonitorList: [],
                    upMonitorSelect: [],
                    up_t_feature_way: '',
                    warnSelect: '',
                    monitorTemp: {
                        key: '',
                        value: ''
                    },
                    taskFeatureList: [],
                    areaCode: '',
                    upAreaCode: '',
                    taskList: [],
                    areaPoint: []
                },
                created: function () { },
                mounted: function () {
                    let self = this
                    self.getTaskType()
                    self.getOpType()
                    self.findTaskByName('-999', self.opSearchWord)
                    self.getEquipments()
                },
                methods: {
                    test() {
                        console.log(this.areaPoint)
                    },
                    routerGo(item) {
                        // 预留头部跳转
                        // this.$router.push(item.path)
                    },
                    goBack() {
                        // 返回bigHome
                        window.location.href = 'bigHome.html'
                        // this.$router.push('bigHome')
                    },
                    chandleAreaChange(value) {
                        console.log(value)
                    },
                    getEquipments() { //获取后台接口传来的设备点    参数val 是不同区域对应的值  1:全城布控 2:区域布控 3:外围布控
                        let self = this
                        let options = {
                            url: 'fs/task/getAllDev'
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.equipmentPoints = res.data.map(val => {
                                        return {
                                            lng: val.x,
                                            lat: val.y,
                                            id: val.devicecode,
                                            address: val.address,
                                            factoryName: val.factoryName,
                                            rowkey: val.rowkey,
                                            source: val.source
                                        }
                                    })
                                } else {
                                    // alert(1)
                                    self.$NotifyUtil({
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    pauseTask(row) { //启停任务方法
                        let self = this
                        let options = {
                            url: 'fs/task/pauseTask',
                            data: {
                                taskId: row.id
                            }
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.$NotifyUtil({
                                        title: row.tName + '停用成功', //row.name 任务名称 
                                        type: 'success',
                                        message: res.msg
                                    })
                                    self.findTaskByName('-999', self.opSearchWord)
                                } else {
                                    self.$NotifyUtil({
                                        title: row.tName + '停用失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    startTask(row) { //启停任务方法
                        let self = this
                        let options = {
                            url: 'fs/task/startTask',
                            data: {
                                taskId: row.id
                            }
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.$NotifyUtil({
                                        title: row.tName + '启用成功', //row.name 任务名称 
                                        type: 'success',
                                        message: res.msg
                                    })
                                    self.findTaskByName('-999', self.opSearchWord)
                                } else {
                                    self.$NotifyUtil({
                                        title: row.tName + '启用失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    handleDelete(row) { //确认是否删除
                        let self = this
                        self.$confirm('此操作将永久删除该任务, 是否继续?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            self.deleteTask(row)
                        }).catch(() => {
                            self.$message({
                                type: 'info',
                                message: '已取消删除'
                            });
                        });
                    },
                    deleteTask(row) { //删除任务方法
                        // if(row.state!)
                        let self = this
                        let loadingOptions = {
                            fullscreen: true,
                            text: '正在删除'
                        }
                        let fullLoading = this.$loading(loadingOptions);
                        let options = {
                            url: 'fs/task/delTask',
                            data: {
                                id: row.id
                            }
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.$NotifyUtil({
                                        title: '删除成功',
                                        type: 'success',
                                        message: res.msg
                                    })
                                    fullLoading.close()
                                    self.findTaskByName('-999', self.opSearchWord)
                                } else {
                                    self.$NotifyUtil({
                                        title: '删除失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    showTask(row) {
                        let self = this
                        let options = {
                            url: 'fs/task/getTask',
                            data: {
                                id: row.id
                            }
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    try {
                                        self.$refs.bigmap.clearAll()
                                    } catch (err) {
                                        console.log(err)
                                    }
                                    self.updateForm.t_task_type_name = res.data.fsdbosTask.tTaskTypeName
                                    self.updateForm.t_name = res.data.fsdbosTask.tName
                                    self.updateForm.t_grade = res.data.fsdbosTask.tGrade
                                    self.updateForm.t_feature_way = res.data.fsdbosTask.tFeatureWay
                                    self.updateForm.t_warning_way = res.data.fsdbosTask.tWarningWay
                                    self.updateForm.t_warning_number =
                                        res.data.fsdbosTask.tWarningNumber
                                    self.updateForm.t_warning_fm = res.data.fsdbosTask.tWarningFm
                                    self.updateForm.t_control_area = res.data.fsdbosTask.tControlArea
                                    self.updateForm.t_control_type = res.data.fsdbosTask.tControlType
                                    setTimeout(function () {
                                        self.areaPoint = res.data.fsdbosDevices.map(val => {
                                            return {
                                                lng: val.dDeviceLng,
                                                lat: val.dDeviceLat,
                                                id: val.dDeviceCode
                                            }
                                        })
                                    }, 500)
                                    if (res.data.fsdbosTask.tControlType === 3) {
                                        self.up_t_control_type = [1, 2]
                                    } else {
                                        self.up_t_control_type = [res.data.fsdbosTask.tControlType]
                                    }
                                    self.up_t_feature_way = res.data.fsdbosTask.tFeatureWay
                                    if (self.up_t_feature_way === 0) {
                                        let list = []
                                        res.data.fsdbosCodes.forEach(val => {
                                            list.push({
                                                key: val.cCodeKey,
                                                value: val.cCodeValue
                                            })
                                        })
                                        self.upMonitorList = list
                                    } else if (self.up_t_feature_way === 1) {
                                        self.upMonitorSelect[1] = res.data.fsdbosCodes[0].cCodeKey
                                        self.upMonitorSelect[0] = res.data.fsdbosCodes[0].feild1
                                        // self.upMonitorSelect[1] = res.data.fsdbosCodes[0].cCodeKey
                                    }
                                    // let list = []
                                    // res.data.fsdbosTask.fsdbosCodes.forEach(val => {
                                    //   list.push({
                                    //     key: val.cCodeKey,
                                    //     value: val.cCodeValue
                                    //   })
                                    // })
                                    // self.upMonitorList = list
                                    self.opControle = 1
                                } else {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    getOpType() { //
                        let self = this
                        let options = {
                            url: 'fs/task/findType'
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.opTypeList = res.data
                                    self.opTypeList.unshift({
                                        key: '-999',
                                        value: '全部'
                                    })
                                } else {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    getTaskType() {
                        let self = this
                        let options = {
                            url: 'fs/task/findFeature'
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    // self.taskFeatureList  = res.data
                                    Array.prototype.indexOf = function (val) {
                                        for (var i = 0; i < this.length; i++) {
                                            if (this[i] == val) return i;
                                        }
                                        return -1;
                                    };
                                    Array.prototype.remove = function (val) {
                                        var index = this.indexOf(val);
                                        if (index > -1) {
                                            this.splice(index, 1);
                                        }
                                    };
                                    for (var i = 0; i < res.data.length; i++) {
                                        // console.log(res.data[i])
                                        if (res.data[i].key === '1') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '2') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '3') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '4') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '12') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '13') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '14') {
                                            res.data.remove(res.data[i])
                                        }
                                        if (res.data[i].key === '15') {
                                            res.data.remove(res.data[i])
                                        }
                                    }
                                    // console.log(res.data)
                                    self.taskFeatureList = res.data
                                } else {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    findTaskByName(id, name) {
                        let self = this
                        let data = {}
                        if (id === '-999') {
                            data = {
                                name: name
                            }
                        } else {
                            data = {
                                type_id: id,
                                name: name
                            }
                        }
                        let options = {
                            url: 'fs/task/findTask',
                            data: data
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.taskList = res.data.list
                                } else {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    handleRemoveFile() {
                        let self = this
                        let options = {
                            url: 'fs/task/delImportid',
                            data: {
                                id: this.importId
                            }
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code !== 0) {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    handleUploadFile(res) {
                        if (res.code !== 0) {
                            this.$refs.upload.clearFiles()
                            return this.$message.error('文件上传失败!');
                        }
                        this.importId = res.data
                    },
                    downloadFile() {
                        // alert(1)
                        window.open('http://10.50.141.246:8090/import.xlsx')
                    },
                    updateOp(row) {
                        let self = this
                        console.log(self, row)
                    },
                    deleteRow(index, row) {
                        let self = this
                        console.log(self, row)
                        self.monitorList.splice(index, 1)
                    },
                    searchOp() {
                        let self = this
                        self.findTaskByName(self.opSelectType, self.opSearchWord)
                    },
                    addOp() {
                        let self = this
                        self.opControle = 0
                        self.areaPoint = []
                        try {
                            self.$refs.bigmap.clearAll()
                        } catch (err) {
                            console.log(err)
                        }
                    },
                    addMoniter() {
                        let self = this
                        self.monitorList.push(Object.assign({}, self.monitorTemp))
                    },
                    formCheck() {
                        let self = this
                        if (!self.addForm.t_task_type_name) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请填写任务类型'
                            })
                            return false
                        }
                        if (self.addForm.t_task_type_name.length > 10) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '任务类型请不要大于10个字符'
                            })
                            return false
                        }
                        if (!self.addForm.t_name) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请填写任务名称'
                            })
                            return false
                        }
                        if (self.addForm.t_name.length > 10) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '任务名称请不要大于10个字符'
                            })
                            return false
                        }
                        if (self.addForm.t_feature_way === undefined || self.addForm.t_feature_way === null || self.addForm.t_feature_way === '') {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '监控列表未填写'
                            })
                            return false
                        } else {
                            if (self.monitorList.length === 0 && self.addForm.t_feature_way === 0) {
                                self.$NotifyUtil({
                                    title: '错误',
                                    type: 'error',
                                    message: '请添加特定特征码'
                                })
                                return false
                            } else if (self.addForm.t_feature_way === 0) {
                                for (let i = 0; i < self.monitorList.length; i++) {
                                    for (let j in self.monitorList[i]) {
                                        if (self.monitorList[i][j] === '') {
                                            self.$NotifyUtil({
                                                title: '错误',
                                                type: 'error',
                                                message: '特定特征码请填写完整'
                                            })
                                            return false
                                        }
                                    }
                                }
                            }
                            if (self.monitorSelect.length === 0 && self.addForm.t_feature_way === 1) {
                                self.$NotifyUtil({
                                    title: '错误',
                                    type: 'error',
                                    message: '请添加区域特征码'
                                })
                                return false
                            }
                            if (!self.importId && self.addForm.t_feature_way === 2) {
                                self.$NotifyUtil({
                                    title: '错误',
                                    type: 'error',
                                    message: '请导入特征码'
                                })
                                return false
                            }
                        }

                        if (!self.addForm.t_grade) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请选择任务等级'
                            })
                            return false
                        }
                        if (!self.addForm.t_warning_way) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请选择告警方式'
                            })
                            return false
                        }
                        if (!self.addForm.t_warning_number) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请输入告警次数'
                            })
                            return false
                        } else {
                            let reg = /^[0-9]*[1-9][0-9]*$/
                            if (!reg.test(self.addForm.t_warning_number)) {
                                self.$NotifyUtil({
                                    title: '错误',
                                    type: 'error',
                                    message: '告警次数应为正整数'
                                })
                                return false
                            }
                        }
                        if (!self.addForm.t_warning_fm) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请选择告警频率'
                            })
                            return false
                        }
                        if (!self.addForm.t_control_area) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请选择布控区域'
                            })
                            return false
                        } else if (self.addForm.t_control_area === 2 && self.areaPoint.length === 0) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请在地图上选择设备'
                            })
                            return false
                        }
                        if (self.t_control_type.length === 0) {
                            self.$NotifyUtil({
                                title: '错误',
                                type: 'error',
                                message: '请选择监控类型'
                            })
                            return false
                        }
                        return true
                    },
                    saveAdd() {
                        let self = this
                        let data = {}
                        let devicesPoint = []
                        self.addForm.t_feature_way = self.t_feature_way
                        if (self.t_control_type.length > 1) {
                            self.addForm.t_control_type = 3
                        } else if (self.t_control_type.length === 1) {
                            self.addForm.t_control_type = self.t_control_type[0]
                        }
                        if (self.addForm.t_control_area === 2) {
                            devicesPoint = self.areaPoint.map(val => {
                                return {
                                    lng: val.lng,
                                    lat: val.lat,
                                    code: val.id
                                }
                            })
                        } else {
                            devicesPoint = self.equipmentPoints.map(val => {
                                return {
                                    lng: val.lng,
                                    lat: val.lat,
                                    code: val.id
                                }
                            })
                        }
                        if (self.t_feature_way === 0) {
                            data = {
                                task: self.addForm,
                                feature: self.monitorList,
                                device: devicesPoint
                            }
                        }
                        if (self.t_feature_way === 1) {
                            data = {
                                task: self.addForm,
                                area: self.monitorSelect[0] + ',' + self.monitorSelect[1],
                                device: devicesPoint
                            }
                        }
                        if (self.t_feature_way === 2) {
                            data = {
                                task: self.addForm,
                                importId: self.importId,
                                device: devicesPoint
                            }
                        }
                        let options = {
                            method: 'POST',
                            url: 'fs/task/saveTask',
                            data: data
                        }
                        if (!self.formCheck()) return false
                        if (self.monitorSelect[1] === '370600') {
                            self.$confirm('本市数据量过大, 确认要新建该任务?', '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                                type: 'warning'
                            }).then(() => {
                                self.$HttpUtil(
                                    options,
                                    res => {
                                        if (res.code === 0) {
                                            self.$NotifyUtil({
                                                type: 'success',
                                                message: res.msg
                                            })
                                            self.addForm = Object.assign({}, self.addFormT)
                                            self.findTaskByName('-999', '')
                                            self.monitorList = []
                                            self.monitorSelect = []
                                            self.t_control_type = []
                                        } else {
                                            self.$NotifyUtil({
                                                title: '失败',
                                                type: 'error',
                                                message: res.msg
                                            })
                                        }
                                    },
                                    err => {
                                        console.log(JSON.stringify(err))
                                    }
                                )
                            }).catch(() => {
                                self.$message({
                                    type: 'info',
                                    message: '已取消'
                                });
                            });
                            return false
                        }
                        self.$HttpUtil(
                            options,
                            res => {
                                if (res.code === 0) {
                                    self.$NotifyUtil({
                                        type: 'success',
                                        message: res.msg
                                    })
                                    self.addForm = Object.assign({}, self.addFormT)
                                    self.findTaskByName('-999', '')
                                    self.monitorList = []
                                    self.monitorSelect = []
                                    self.t_control_type = []
                                } else {
                                    self.$NotifyUtil({
                                        title: '失败',
                                        type: 'error',
                                        message: res.msg
                                    })
                                }
                            },
                            err => {
                                console.log(JSON.stringify(err))
                            }
                        )
                    },
                    addFormgrd(key) {
                        let self = this
                        self.addForm.t_grade = key
                        if (key === 1) {
                            self.addForm.t_warning_number = 5
                            self.addForm.t_warning_fm = 5000
                        } else if (key === 2) {
                            self.addForm.t_warning_number = 4
                            self.addForm.t_warning_fm = 60000
                        } else if (key === 3) {
                            self.addForm.t_warning_number = 3
                            self.addForm.t_warning_fm = 120000
                        } else if (key === 4) {
                            self.addForm.t_warning_number = 2
                            self.addForm.t_warning_fm = 300000
                        }
                    }
                },
                filters: {
                    areaFilter(val) {
                        return CodeToText[val]
                    }
                },
                watch: {}
            })
        })
    </script>
</body>

</html>